package usefulUtils;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author le
 */
public class FileResolveUtils
{

    public static void main(String[] args) throws IOException
    {
        // 存储读取的文件和值
        ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(0);
        int index = 0;
        //读取文件
        BufferedReader br = null;
        try {
            /// 这里可以控制编码
            String stringPath = "C:\\Users\\le\\Desktop\\盯盯拍\\info\\Languages\\Localizable_de.strings";
            br = new BufferedReader(new InputStreamReader(new FileInputStream(stringPath), StandardCharsets.UTF_8));
            /// 计算行数
            String line = null;
            while ((line = br.readLine()) != null) {
                String[] split = line.split("=");
                map.put(split[0], split[1]);
                index++;
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (br != null)
            {
                br.close();
            }
        }
        for(Map.Entry<String, String> entry: map.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
        System.out.println(index);
        /// System.out.println("addressBook.txt内容为==> " + s);
    }
}
